<%--
  @author Tharanga Punchihewa
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<s:set name="usr" value="registerUser"/>
<script type="text/javascript">
    $(document).ready(function() {
        $("#create-user").validate({
            rules: {
                usernameId:{
                    required: true
                },
                fullnameId:{
                    required: true
                },
                emailId:{
                    required: true,
                    email:true
                },
                mobileId:{
                    phoneNo:true
                },
                landPhoneId:{
                    phoneNo:true
                }
            },
            messages: {
                uernameId:{
                    required: "<br>" + "Please enter a username"
                },
                fullnameId:{
                    required: "<br>" + "Please enter your full name"
                },
                emailId:{
                    required: "<br>" + "Please enter your email",
                    email:"<br>" + "Please enter a valid email"
                },
                mobileId:{
                    phoneNo:"<br>" + "Please specify a valid phone number"
                },
                landPhoneId:{
                    phoneNo:"<br>" + "Please specify a valid phone number"
                }
            }
        });
    });
</script>

<div id="user-module-home-title" class="module-home-title">
    <s:a href="organizationUserManagement.do"><img src="${pageContext.request.contextPath}/images/user.png"
                                                          alt="Organization User Module"><span><s:label
            value="%{getText('user_module.label')}"/></span></s:a>
</div>
<%--<div id="create-user-div">--%>
<h2><s:label value="%{getText('create_user.label')}"/></h2>
<hr/>
<s:form id="create-user" name="create-user" action="/createORPIIUser.do" method="POST">
    <table>
        <tr>
            <td colspan="3" class="left-align">
                <div class="action-msg"><s:actionmessage/></div>
                <div class="action-err"><s:actionerror/></div>
            </td>
        </tr>

        <tr>
            <td class="left-align"><s:label value="%{getText('user_name.label')}" cssClass="mandatory-field"/></td>
            <td colspan="2" class="left-align">
                <s:if test="editMode==1">
                    <s:textfield name="registerUser.username" id="usernameId" readonly="true"/>
                </s:if>
                <s:else>
                    <s:textfield name="registerUser.username" id="usernameId"/>
                </s:else>

            </td>
        </tr>
        <tr>
            <td class="left-align"><s:label value="%{getText('full_name.label')}" cssClass="mandatory-field"/></td>
            <td colspan="2" class="right-align">
                <s:textarea name="registerUser.fullName" id="fullnameId" cssClass="width-450-px"/>
            </td>
        </tr>
        <tr>
            <td class="left-align"><s:label value="%{getText('address.label')}"/></td>
            <td colspan="2" class="left-align">
                <s:textarea name="registerUser.address" id="addressId" cssClass="width-450-px"/>
            </td>
        </tr>
        <tr>
            <td rowspan="2"><s:label value="%{getText('telephone.label')}"/></td>
            <td><s:label value="%{getText('mobile.label')}"/></td>
            <td><s:textfield name="registerUser.mobile" id="mobileId"/></td>
        </tr>
        <tr>
            <td><s:label value="%{getText('land_phone.label')}"/></td>
            <td><s:textfield name="registerUser.landPhone" id="landPhoneId"/></td>
        </tr>
        <tr>
            <td class="left-align"><s:label value="%{getText('email.label')}" cssClass="mandatory-field"/></td>
            <td colspan="2" class="left-align"><s:textfield name="registerUser.email" id="emailId"/></td>
        </tr>
        <tr>
            <s:hidden name="organizationId"/>
            <s:hidden name="userRoleId"/>
            <s:hidden name="editMode"/>
            <td colspan="3" class="right-align">
                <s:if test="editMode==1">
                    <s:hidden name="registerUser.username"/>
                    <s:submit value="%{getText('edit.label')}"/>
                </s:if>
                <s:else>
                    <s:hidden name="urmgoiUserId"/>
                    <s:submit value="%{getText('create_user.label')}"/>
                </s:else>

            </td>
        </tr>
    </table>
</s:form>
<%--
</div>--%>
